package fauxman.controller;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import fauxman.model.WorldModel;
import fauxman.utilities.ActionUtil;

public class FauxmanController implements KeyListener{
	private WorldModel wm;
	
	public FauxmanController(WorldModel wm){
		this.wm = wm;
		
	}
	
	public void keyPressed(KeyEvent e) {
		switch(e.getKeyCode())
		{
			case KeyEvent.VK_UP:{
				wm.setFauxmanDirection(ActionUtil.NORTH);
			}break;
			case KeyEvent.VK_DOWN:{
				wm.setFauxmanDirection(ActionUtil.SOUTH);			
			}break;
			case KeyEvent.VK_LEFT:{
				wm.setFauxmanDirection(ActionUtil.WEST);
			}break;
			case KeyEvent.VK_RIGHT:{
				wm.setFauxmanDirection(ActionUtil.EAST);
			}break;
			case KeyEvent.VK_SPACE:{
				wm.togglePauseGame();
			}break;
			case KeyEvent.VK_ESCAPE:{
				System.exit(0);
			}break;
			default:{
				System.out.println(e.getKeyChar() + " " + e.getKeyCode());
			}
		}
	}

	public void keyReleased(KeyEvent e) {
		
	}

	public void keyTyped(KeyEvent e) {
		
	}
	
}
